package com.manning.s2ip.ch01ex01;

import com.opensymphony.xwork2.ActionSupport;

public class EchoAction extends ActionSupport {

    private String message;
    private int count;
    private String repeatedMessage;
    
    @Override
    public String execute() {
        StringBuffer tempRepeatedMessage = new StringBuffer();
        for (int i = 0 ; count > 0 && i < count ; i++) {
            tempRepeatedMessage.append(message + "\n");
        }
        repeatedMessage = tempRepeatedMessage.toString();
        return SUCCESS;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getRepeatedMessage() {
        return repeatedMessage;
    }

}
